package com.yunfeisoft.business.model;

import com.yunfeisoft.common.base.BaseModel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.List;

/**
 * ClassName: Room
 * Description: 房间
 *
 * @Author: Jackie liu
 * Date: 2020-01-13
 */
@Entity
@Table(name = "TT_ROOM")
public class Room extends BaseModel implements Serializable {

    /**
     * Field serialVersionUID: 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * 楼层号
     */
    @Column
    private String floorNum;

    /**
     * 房间号
     */
    @Column
    private String roomNum;

    /**
     * 类型(1单人间，2双人间，3三人间)
     */
    @Column
    private String type;

    private List<Bed> bedList;


    public String getTypeStr() {
        return RoomTypeEnum.valueOf(Integer.valueOf(type));
    }

    public String getFloorNum() {
        return floorNum;
    }

    public void setFloorNum(String floorNum) {
        this.floorNum = floorNum;
    }

    public String getRoomNum() {
        return roomNum;
    }

    public void setRoomNum(String roomNum) {
        this.roomNum = roomNum;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public List<Bed> getBedList() {
        return bedList;
    }

    public void setBedList(List<Bed> bedList) {
        this.bedList = bedList;
    }

    public enum RoomTypeEnum {

        ONE(1, "单人间"),
        TWO(2, "双人间"),
        THREE(3, "三人间");

        private int value;
        private String label;

        private RoomTypeEnum(int value, String label) {
            this.value = value;
            this.label = label;
        }

        public static String valueOf(Integer value) {
            if (value == null) {
                return null;
            }
            for (RoomTypeEnum loop : RoomTypeEnum.values()) {
                if (value == loop.getValue()) {
                    return loop.getLabel();
                }
            }
            return null;
        }

        public int getValue() {
            return value;
        }

        public String getLabel() {
            return label;
        }
    }
}